package com.ruoyi.web.controller.comment.admin;

import com.ruoyi.comment.service.ICommentService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.model.comment.Comment;
import com.ruoyi.model.comment.params.CommentCategoryParams;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : 张怀秋
 **/
@Api(tags = "后台:评论服务")
@Slf4j
@RestController
@RequestMapping("/admin/comment")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CommentAdminController extends BaseController {
    private final ICommentService commentService;

    @ApiOperation(value = "根据分类选择列表", notes = "带分页")
    @GetMapping("/activitySByCategoryId")
    public TableDataInfo activitySByCategoryId(CommentCategoryParams categoryParams) {
        startPage();
        return getDataTable(this.commentService.findAllAtivitysByCategoryId(categoryParams));
    }

    @ApiOperation(value = "根据详情id分页查询评论列表", notes = "根据详情id分页查询评论列表")
    @GetMapping("/findCommentListByDetailId/{page}/{limit}/{type}/{detailId}")
    public AjaxResult findCommentListByDetailId(@PathVariable Long page,
                                                @PathVariable Long limit,
                                                @PathVariable String type,
                                                @PathVariable String detailId,
                                                Comment comment) {
        return success(this.commentService.selectCommentListByDetailId(page, limit, type, detailId, comment));
    }

}
